May, 20 2023

Assignment - Plotly using mtcars dataset

For this example we will try to show the previous analysis the relationship between MPG (Miles Per Gallon) and types of vehicle (automatic/ manual)

library(plotly)
library(webshot)
data(mtcars)
mtcars$am <- as.factor(mtcars$am)
levels(mtcars$am) <- c("Automatic", "Manual")
p1 <- plot_ly(
  data = mtcars,
  y = ~mpg,
  x = ~am,
  type = "box"
)

Plot Result

p1

Thank You